package com.springcloud.eureka_provider.controller;

import java.util.ArrayList;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
import com.springcloud.eureka_provider.model.User;

/**
 * @author hw
 * 服务提供者
 */
@RestController
public class UserController {
	
	private ArrayList<User> users=new ArrayList<User>();
	
	@GetMapping("/user/{id}")
	public User getUser(@PathVariable("id") int id) {
		for(int i=0;i<5;i++) {
			users.add(new User(i,String.valueOf("name"+i)));
		}
		User user=users.get(id);
		System.out.println(user);
		return user;
	}

}
